using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace ns
{
    ///<summary>
    ///
    ///</summary>
    public class Lightning : MonoBehaviour
    {
        public Light light;

        private void Start()
        {
            light = GetComponent<Light>();
            StartCoroutine(LightningCoroutine());
        }

        public IEnumerator LightningCoroutine()
        {
            while (true)
            {
                light.enabled = true;
                yield return new WaitForSeconds(0.3f);
                light.enabled = false;
                yield return new WaitForSeconds(Random.Range(0.5f, 2f));
                light.enabled = true;
                yield return new WaitForSeconds(0.1f);
                light.enabled = false;
                yield return new WaitForSeconds(0.1f);
                light.enabled = true;
                yield return new WaitForSeconds(0.1f);
                light.enabled = false;
                yield return new WaitForSeconds(Random.Range(0.5f, 2f));
            }
        }
    }
}
